package com.zmn.oms.business.impl.third;

import com.zmn.oms.business.interfaces.third.PinDuoDuoSignShopService;
import com.zmn.oms.model.entity.third.PinDuoDuoSignShop;
import com.zmn.oms.persistence.interfaces.third.PinDuoDuoSignShopDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类描述：拼多多操作签约店铺接口
 *
 * @author wangxiaokun
 * @since 2020/6/1619:21
 */
@Service("pinDuoDuoSignShopService")
public class PinDuoDuoSignShopServiceImpl implements PinDuoDuoSignShopService {

    @Resource
    private PinDuoDuoSignShopDao pinDuoDuoSignShopDao;

    /**
     * 根据店铺id查询店铺信息
     * @param mallId
     * @return com.zmn.oms.model.entity.third.PinDuoDuoSignShop
     * @author wangxiaokun
     */
    @Override
    public PinDuoDuoSignShop findPinDuoDuoSignShopByMallId(Long mallId) {
        return pinDuoDuoSignShopDao.findPinDuoDuoSignShopByMallId(mallId);
    }

    /**
     * 查询已签约或已拒绝，还没有同步签约结果状态的店铺信息
     * @return java.util.List<com.zmn.oms.model.entity.third.PinDuoDuoSignShop>
     * @author wangxiaokun
     */
    @Override
    public List<PinDuoDuoSignShop> listPinDuoDuoSignShopBySyncStatus() {
        return pinDuoDuoSignShopDao.listPinDuoDuoSignShopBySyncStatus();
    }

    /**
     * 查询渠道id是否为拼多多店铺渠道id
     * @param channelId
     * @return boolean
     * @author wangxiaokun
     */
    @Override
    public boolean checkPddChannelId(Integer channelId) {
        Integer count = pinDuoDuoSignShopDao.countPddChannelId(channelId);
        return count > 0;
    }

    /**
     * 根据店铺id修改店铺签约信息
     * @param pinDuoDuoSignShop
     * @return java.lang.Integer
     * @author wangxiaokun
     */
    @Override
    public Integer modifyPinDuoDuoSignShopByMallId(PinDuoDuoSignShop pinDuoDuoSignShop) {
        return pinDuoDuoSignShopDao.updatePinDuoDuoSignShopByMallId(pinDuoDuoSignShop);
    }

    /**
     * 插入店铺签约信息
     * @param pinDuoDuoSignShop
     * @return java.lang.Integer
     * @author wangxiaokun
     */
    @Override
    public Integer addPinDuoDuoSignShop(PinDuoDuoSignShop pinDuoDuoSignShop) {
        return pinDuoDuoSignShopDao.insertPinDuoDuoSignShop(pinDuoDuoSignShop);
    }

}
